<?php

/* 文章控制器
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require dirname(dirname(__FILE__)) . '/include/init.php';
require model('article');
session_start();

$action = $_GET['action'];

if ($action == 'add') {
    $editor = get_editor(); //文章编辑器
    $categorys = selcate(); //文章的‘分类’   
    $url = 'article.php?action=doadd'; //输入信息提交的页面
    include WEB_ROOT . '/admin/template/menu1_addarticle.html.php';
} elseif ($action == 'doadd') {
    //处理发布文章提交的内容
    if (isset($_POST['submit'])) {
       submit_article($_POST['categorys'],$_POST['title'],$_POST['description'],$_POST['keywords'],$_POST['FCKeditor1']);
       }
} elseif ($action == 'default') {
    $articles = manart(); //读出文章列表
    include WEB_ROOT . '/admin/template/menu1_manarticle.html.php';
} elseif ($action == 'edit') {//文章修改页面
    $aid = $_GET['aid'];
    $cid = $_GET['cid'];
    //根据aid将文章中的内容都读书来
    $_articles = show_art($aid); //(包含文章所有内容的数组)
    $editor = get_editor($_articles['content']); //文章编辑器

    $categorys = selcate($cid); //文章的‘分类’
    $url = 'article.php?action=doedit&aid=' . $aid . ''; //输入信息提交的页面
    include WEB_ROOT . '/admin/template/menu1_addarticle.html.php';
} elseif ($action == 'doedit') {//处理文章修改提交时的信息
    global $_DBLINK;
    $aid = $_GET['aid'];
    if (isset($_POST['submit'])) {
        edit_article($_POST['categorys'],$_POST['title'],$_POST['description'],$_POST['keywords'],$_POST['FCKeditor1'],$aid);       
    }
} elseif ($action == 'del') {//文章删除信息
    $aid = $_GET['aid'];
    //提示是否删除信息
    confirm_msg('您确定要删除该文章吗？', '/admin/article.php?action=dodel&aid=' . $aid . '', '/admin/article.php?action=default');
} elseif ($action == 'dodel') {
    $aid = $_GET['aid'];
    del_art($aid);
} 
 
 